
package ch.hearc.meteo.imp.afficheur.real.moo;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;

import javax.swing.table.DefaultTableCellRenderer;

public class MeteoTableHeaderRenderer extends DefaultTableCellRenderer
	{

	/*------------------------------------------------------------------*\
	|*							Constructeurs							*|
	\*------------------------------------------------------------------*/
	public MeteoTableHeaderRenderer(Image img)
		{
		this.img = img;

		}

	/*------------------------------------------------------------------*\
	|*							Methodes Public							*|
	\*------------------------------------------------------------------*/
	@Override
	protected void paintComponent(Graphics g)
		{
		//super.paintComponent(g);
		Graphics2D g2 = (Graphics2D)g;
		g2.setColor(Color.BLACK);
		g2.drawLine(0, 0, 0, 50);

		int titleX = 10;
		if (img != null)
			{
			int x = (this.getWidth() - img.getWidth(this)) / 2;
			g2.drawImage(img, 5, 3, null);
			titleX += img.getWidth(this);
			}
		g2.setColor(Color.WHITE);
		g2.setFont(g2.getFont().deriveFont(14.0f));
		g2.drawString(getText(), titleX, 25);
		}

	/*------------------------------*\
	|*				Set				*|
	\*------------------------------*/

	/*------------------------------*\
	|*				Get				*|
	\*------------------------------*/

	/*------------------------------------------------------------------*\
	|*							Methodes Private						*|
	\*------------------------------------------------------------------*/

	/*------------------------------------------------------------------*\
	|*							Attributs Private						*|
	\*------------------------------------------------------------------*/

	//Inputs
	private Image img;
	}
